<template>
	<view class="content">
		<!-- 轮播 -->
		<x-rotation :imgArr='indexNav.Rotation' height='500'></x-rotation>
		<view class="">
			<x-title :showIcon="false" title="爆款产品" Subtitle='热卖'></x-title>
			<x-commodity-list ref='deec0'></x-commodity-list>
		</view>
		<view class="">
			<x-title :title="indexNav.title" :Subtitle='indexNav.desc'></x-title>
			<image style="height: 500rpx;" class="data-img w-100 mt-30" :src="indexNav.image1" mode="aspectFill">
			</image>
		</view>
		
		<view class="">
			<x-title :showIcon="false" :title="indexNav.cate_id1_name" :Subtitle='indexNav.desc1'></x-title>
			<x-commodity-list ref='deec1'></x-commodity-list>
		</view>
		<view class="mt-60">
			<image style="height: 500rpx;" class="data-img w-100 mt-30" :src="indexNav.image2" mode="aspectFill">
			</image>
		</view>
		<view class="">
			<x-title :showIcon="false" :title="indexNav.cate_id2_name" :Subtitle='indexNav.desc2'></x-title>
			<x-commodity-list ref='deec2'></x-commodity-list>
		</view>
		<view class="px-30">
			<view class=" font-w mt-60"><text>新品上线</text></view>
			<x-goods ref='goodsData'></x-goods>
		</view>

	</view>
</template>

<script>
	import {
		http_other_nav_index
	} from '@/config/apiRouter.js'
	export default {
		data() {
			return {
				indexNav: {
					Rotation: []
				}, // 首页轮播/背景图配置
			}
		},
		onLoad() {
			// 首页轮播/背景图配置
			this.getOther_navIndex()
			//新品上线 
			this.$refs.goodsData.gerGoodsProp({})
			this.$refs.deec0.getGoodsData({
				sort:'sale_desc'
			})
		},
		// 上拉触底
		onReachBottom() {
			this.$refs.goodsData.comtsOnReachBottom()
		},
		methods: {
			getOther_navIndex() {
				http_other_nav_index().then(res => {
					console.log(res);
					this.indexNav = res.data
					// 轮播图
					this.indexNav.Rotation = res.data.image.split('|')
					// 类别商品
					this.$refs.deec2.getGoodsData({
						cate_id: res.data.cate_id1
					})
					this.$refs.deec1.getGoodsData({
						cate_id: res.data.cate_id2
					})
				})
			}
		},
		onShareTimeline(res) {
			console.log(res);
		},
	}
</script>

<style lang="scss" scoped>

</style>
